package com.crape.dict.bo.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.crape.common.exceptions.BOException;
import com.crape.common.model.DictCity;
import com.crape.common.model.DictDistrict;
import com.crape.common.model.DictProvince;
import com.crape.dict.bo.IAreaBO;
import com.crape.dict.dao.IAreaDAO;

@Service
public class AreaBOImpl implements IAreaBO {
    
    private IAreaDAO areaDAOImpl;
    
    @Autowired
    public void setAreaDAOImpl(IAreaDAO areaDAOImpl) {
        this.areaDAOImpl = areaDAOImpl;
    }

    @Override
    public List<DictProvince> getAllProvinces() throws BOException {
        return areaDAOImpl.findAllProvinces();
    }

    @Override
    public List<DictCity> getCitysByProvinceId(Long provinceId) throws BOException {
        return areaDAOImpl.findCitysByProvinceId(provinceId);
    }

    @Override
    public List<DictDistrict> getDistrictsByCityId(Long cityId) throws BOException {
        return areaDAOImpl.findDistrictsByCityId(cityId);
    }

}
